class Animal{
    public String name;
    public int age;
    static {
        System.out.println("Animal static{}");
    }
    {
        System.out.println("Animal{}");
    }
    public Animal() {
        System.out.println("Animal()");
    }
    public Animal( String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("带有2个参数的构造方法");
    }

    public void eat(){
        System.out.println(name+"正在吃饭");
    }
}

class Dog extends Animal{
    static {
        System.out.println("Dog static{}");
    }
    {
        System.out.println("Dog{}");
    }
    public  Dog(){
        //super("七月",10);
        System.out.println("DOG()");
    }
    public Dog(String name,int age) {
        super(name, age);
    }
    //public  Dog(String name,int age){
        //super(name, age);
        //super("七月",10);//显示的调用父类的构造方法，帮助父类的成员进行初始化
    //}
    public void wangwang(){
        System.out.println(name+"旺旺叫");
    }
}
class Cat extends Animal{
    public Cat(String name,int age) {
        super(name, age);
    }
    public void miaomiao(){
        System.out.println(name+"喵喵叫");
    }
        }
public class Main2 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        //Dog DOG = new Dog("DWAD",10);
        //Cat cat = new Cat("喵喵",10);
        //DOG.wangwang();
        //cat.miaomiao();
    }
}
/*Animal static{}
  Dog static{}静态最先执行 且只执行一次
  Animal{}父类优先执行
  Animal()
  Dog{}然后在执行子类
  DOG()

加上“final”的类不能被继承，加到变量前面会变成常量，不能被修改

        */